﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Editor.PageControls;

namespace Editor
{
    public partial class PropertiesFormBase : AddFormBase
    {
        public PropertiesFormBase()
        {
            InitializeComponent();
        }

        public string ControlName { get; set; }

        private void PropertiesFormBase_VisibleChanged(object sender, EventArgs e)
        {
            if (Visible == true)
                OnLoad(e);
        }

        protected virtual void PropertiesForm_Load(object sender, EventArgs e)
        {
            //StartPosition = FormStartPosition.Manual;
            Location = new Point(EditorForm.Instance.ClientSize.Width - Width,
                EditorForm.Instance.ClientSize.Height - Height);
        }

        protected virtual void buttonApply_Click(object sender, EventArgs e)
        {
            PageControl.SelectedControl.UpdateInnerControl();
            EditorForm.RefreshCanvas();
            EditorForm.IsSaved = false;
            Visible = false;
        }

        protected virtual void buttonRemove_Click(object sender, EventArgs e)
        {
            EditorForm.RemoveSelectedControl();
            Visible = false;
        }

        protected virtual void buttonRelocate_Click(object sender, EventArgs e)
        {
            EditorForm.Relocating = true;
            Visible = false;
        }

        protected virtual void buttonCopy_Click(object sender, EventArgs e)
        {
            EditorForm.Copying = true;
            Visible = false;
        }
    }
}
